import E from 'wangeditor' 
const {
    BtnMenu,
} = E


class ImageExtends extends BtnMenu {
    constructor(editor) {
        const $elem = E.$(
            `<div class="w-e-menu" data-title="图片 ">
                <i class="w-e-icon-image"></i>
            </div>`
        )
        super($elem, editor)

    }
    // 菜单点击事件
    clickHandler(e) {
        Vue.prototype.$vFN.Directives.SelectResourcesImage({
            appWindow:this.editor.appWindow,
            apiConfig:this.editor.apiConfig,
            onSuccess: (res) => {
                res.data.forEach(item => {
                    this.editor.cmd.do('insertHTML', '<img src='+item+' style="max-width: 100%;"/>')
                })
            },

        });
    }
    tryChangeActive() {  
    }
}
export default ImageExtends